import {customRef} from 'vue'
export function useDebouncedRef(value:string,delay=200) {
    let timeout:string
    return customRef((track,trigger) => {
        return {
            get(){
                track()
                return value
            },
            set(newVal){
                clearTimeout(timeout)
                timeout = setTimeout(() => {
                    value = newVal
                    trigger()
                },delay)
            }
        }
    })
}
